package com.concurrent.chapter1.concurrent08;

import java.util.concurrent.Exchanger;

public class ThreadA extends Thread {
	private Exchanger<String> exchanger;
	public ThreadA(Exchanger<String> exchanger) {
		super();
		this.exchanger = exchanger;
	}
	@Override
	public void run() {
		try {
			System.out.println("A线程获得的值：" + exchanger.exchange("String from threadA"));
			System.out.println("threadA end");
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
